#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  LL n;
  cin >> n;
  int k = int(log2(n + 2)) - 1; // 至少多少层
  //   cout << k << endl;
  if (1ll << (k + 1) == n + 2) {
    cout << string(k, '8');
    return 0;
  }
  n -= ((1ll << (k + 1)) - 2); // 在最下一层第几个
  n--;
  //   cout << n << endl;
  for (int i = k; i >= 0; i--) {
    if (n & (1ll << i))
      cout << '8';
    else
      cout << '6';
  }
  return 0;
}